<template>
  <div>
    <div>
      <input type="text">
      <button @click="send">点击我进行测试</button>
      <div v-for="item in cateGoryList">
        {{item.name}}

      </div>
      {{getUserInfo.username}}
      <button @click="setUserinfo">点击我给用户基本信息赋值</button>
    </div>

    <el-upload
        class="upload-demo"
        action="https://www.demo.com/posts/"
        multiple
        :file-list="[{name: 'name', url: 'url'}, {name: 'name2', url: 'url'}]">
      <el-button size="small" type="primary">点击上传</el-button>
      <div slot="tip" class="el-upload__tip">只能上传jpg/png文件，且不超过500kb</div>
    </el-upload>12312
  </div>
</template>

<script>
// @ is an alias to /src
import HelloWorld from '@/components/HelloWorld.vue'
import {listSearchMixin} from "@/config/mixin";
import {mapGetters} from "vuex";
import {mapMutations} from "vuex";
export default {
  name: 'About',
  mixins:[listSearchMixin],
  data(){
    return{
      cateGoryList:[]
    }
  },
  computed:{
    ...mapGetters(['getUserInfo'])
  },
  components: {
    HelloWorld
  },
  methods:{

    ...mapMutations(['SET_USERINFO']),
    // 文件上传方法
    upload(file){
      console.log(file)

      let params={
        url:'/upload',
        method:'post',
        data:{
          'fileName':file
        }
      }
      this.sendReq(params,res=>{
        console.log('执行成功');
        console.log(res)
      })
    },
    setUserinfo(){
      this.SET_USERINFO({username:'liuxing'})
    },
    send(){
      let params={
        url:'prod-api/press/category/list',
        method:'get',
        contentType:'application/x-www-form-urlencoded'
      }
      this.sendReq(params,(res)=>{
        this.cateGoryList = res.data;
      })
    }
  }
}
</script>
